package mo.offer_version2;

public class L15 {

    public int hammingWeight(int n) {
        int res = 0;
        while (n != 0) {
            res += (n & 1);
            n = n >>> 1;
        }
        return res;
    }

    public static void main(String[] args) {
        L15 test = new L15();
        System.out.println(test.hammingWeight(-3));
    }

}
